home *** CD-ROM | disk | FTP | other *** search
/ APDL Other Worlds / APDL Other Worlds Collection.iso / SF3000 / Extras / CBlibrary / h / SFformats < prev    next >
Encoding:
Text File  |  2003-10-24  |  11.7 KB  |  482 lines

  1. /*
  2.  * CBLibrary - SFformats
  3.  * Copyright (C) 2003  Chris Bazley
  4.  *
  5.  * This library is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU Lesser General Public
  7.  * License as published by the Free Software Foundation; either
  8.  * version 2.1 of the License, or (at your option) any later version.
  9.  *
  10.  * This library is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * Lesser General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU Lesser General Public
  16.  * License along with this library; if not, write to the Free Software
  17.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18.  */
  19.  
  20. /* Star Fighter 3000 data formats 
  21.    13.09.03 CJB Changed the names of various of the types and structures.
  22. */
  23.  
  24. #ifndef SFformats_h
  25. #define SFformats_h
  26.  
  27. /* 
  28.   Hill and polygon colours
  29. */
  30.  
  31. #define FILETYPE_FEDNET   0x154
  32.  
  33. /* 
  34.   Level animations
  35.   Purpose: Holds a list of ground map animations for a given mission.
  36. */
  37.  
  38. #define FILETYPE_ANIMS    0x408
  39.  
  40. /* (the following may be a load of crap BTW) */
  41. typedef struct _SF_AnimationsHdr
  42. {
  43.   int num_animations; /* Number of animations held */
  44.   int free_A;
  45.   int free_B;
  46.   int free_C;
  47. } SF_AnimationsHdr;
  48.  
  49. typedef struct _SF_Animation
  50. {
  51.   int map_offset;
  52.   int timer_counter;
  53.   int reset_timer_and_current; /* b1,b0 = Timer reset ctr, b3,b2 = Current Spr# */
  54.   int tile_1; /* Sprite # byte, Expanded on load to sprite location */
  55.   int tile_2; 
  56.   int tile_3;
  57.   int tile_4;
  58. } SF_Animation;
  59.  
  60. /*
  61.   Polygonal graphics set 
  62.   Purpose: Defines a complete set of polygonal objects - including all
  63.            fighters, spaceships, ground installations, bonus coins etc.
  64. */
  65.  
  66. #define FILETYPE_POLYOBJS 0x300
  67.  
  68. typedef int SF_PolyObjectsSetHdr; /* FILE FORMAT UNKNOWN !!! */
  69.  
  70. /* 
  71.   Ground map/overlay file format
  72.   Purpose: Holds a base ground map or mission-specific overlay.
  73. */
  74.  
  75. #define FILETYPE_BASEMAP  0x400
  76. #define FILETYPE_LEVELMAP 0x401
  77.  
  78. typedef char SF_GroundMap[256][256];
  79.  
  80. /* 
  81.   Map tiles stamp file format
  82.   Purpose: Used by the level editor to hold smaller map areas
  83. */
  84.  
  85. typedef struct _SF_GroundMapStampHdr
  86. {
  87.   char file_version; /* for future expansion */
  88.   char width;
  89.   char height;
  90.   char free;
  91.   /*-- tiles (same format as map overlay) follow here in memory --*/
  92.   char tiles[];
  93. } SF_GroundMapStampHdr;
  94.  
  95. /* 
  96.   Object map/overlay file format
  97.   Purpose: Holds a base ground objects grid or mission-specific overlay.
  98. */
  99.  
  100. #define FILETYPE_BASEOBJS  0x402
  101. #define FILETYPE_LEVELOBJS 0x403
  102.  
  103. typedef char SF_ObjectsGrid[128][128];
  104.  
  105. /* 
  106.   Sky colour definition file
  107.   Purpose: Stores the colours used to paint a planetary atmosphere.
  108. */
  109.  
  110. #define FILETYPE_SKYCOLS 0x404
  111.  
  112. typedef struct _SF_SkyColours
  113. {
  114.   int min_sky_height;
  115.   int min_stars_height;
  116.   unsigned int shade[126];
  117. } SF_SkyColours;
  118.  
  119. /* 
  120.   Mission file format
  121.   Purpose: Stores all details about a mission, including the text
  122.            briefing, location briefings, details of flying ships,
  123.            flightpaths, ship performance data, map and graphics to use.
  124. */
  125.  
  126. #define FILETYPE_MISSION 0x405
  127.  
  128. /* Ground checks - triggered when object destroyed */
  129. #define SF_TRIGGER_FIXSCANNERS       13
  130. #define SF_TRIGGER_FRIENDLYDEAD      11
  131. #define SF_TRIGGER_MISSIONTIMER      10
  132. #define SF_TRIGGER_CASHBONUS         9
  133. #define SF_TRIGGER_CRIPPLESHIPTYPE   8
  134. #define SF_TRIGGER_DUMMY             7 /* may be used as base of chain reaction */
  135. #define SF_TRIGGER_CHAINREACTION     6
  136. #define SF_TRIGGER_DEFENCETIMER      5
  137. #define SF_TRIGGER_MINES_BONUS       4
  138. #define SF_TRIGGER_BOMBS_BONUS       3
  139. #define SF_TRIGGER_MEGALASER_BONUS   2
  140. #define SF_TRIGGER_MULTIATA_BONUS    1
  141. #define SF_TRIGGER_MISSIONTARGET     0
  142.  
  143. typedef struct _SF_Trigger
  144. {
  145.   char x_pos;
  146.   char y_pos;
  147.   char action_type;
  148.   char action_param;
  149. } SF_Trigger;
  150.  
  151. typedef int SF_LocationBrief;
  152.  
  153. typedef struct _SF_ShipPerfData
  154. {
  155.   int laser_freq;
  156.   int laser_type;
  157.   int engine;           /* Fighters only */
  158.   int control;          /* Fighters only */
  159.   int shields;
  160.   int ATA_freq;         /* Fighters only */
  161.   int pleb_launch_freq; /* Big ships only */
  162.   int num_plebs;        /* Big ships only */
  163. } SF_ShipPerfData;
  164.  
  165. #define SHIPADDER_FLAGS1_STARTMODE       (1u << 0)
  166. #define SHIPADDER_FLAGS1_FRIENDLY        (1u << 2)
  167. #define SHIPADDER_FLAGS1_CLOAKED         (1u << 3)
  168.  
  169. #define SHIPADDER_STARTMODE_ATTACK       0
  170. #define SHIPADDER_STARTMODE_FLIGHTPATH   1
  171. #define SHIPADDER_STARTMODE_FOLLOWSHIP   2
  172.  
  173. #define SHIPADDER_FLAGS2_IGNOREATTACK    (1u << 0)
  174. #define SHIPADDER_FLAGS2_PROXIMITYACTION (1u << 1)
  175.  
  176. #define SHIPADDER_MISSIONSIG_NONE        0
  177. #define SHIPADDER_MISSIONSIG_DESTROY     1
  178. #define SHIPADDER_MISSIONSIG_PROTECT     2
  179. #define SHIPADDER_MISSIONSIG_FINISHPATH  3
  180. #define SHIPADDER_MISSIONSIG_NOTLAND     5
  181.  
  182. #define SHIPADDER_BIGSHIP_MOVES          0
  183. #define SHIPADDER_BIGSHIP_SPINS          1
  184. #define SHIPADDER_BIGSHIP_ROTATES        2
  185. #define SHIPADDER_BIGSHIP_STATIONARY     3
  186.  
  187. typedef struct _SF_ShipAdderData
  188. {
  189.   int xpos;
  190.   int ypos;
  191.   int height;
  192.   char type; /* (1-4, 13-15, 21) */
  193.   char flags_1;
  194.   /*  [b0-b1]    Start mode (0=Attack, 1=Flightpath, 2=Follow ship)
  195.       [b2]    Allegiance (0=Enemy, 1=Friendly)
  196.       [b3]    Cloaking on? (0=No, 1=Yes) */
  197.   char flightpath_startpoint;
  198.   char FP_or_ship_to_follow;
  199.   /*  If flightpath,  then path number (0-7)
  200.       If ship follow, then ship number (0-15, 255=follow players ship) */
  201.  
  202.   int x_follow_offset;
  203.   int y_follow_offset;
  204.   int height_follow_offset;
  205.   char mission_significance;
  206.   /* (0=None,
  207.       1=Must kill,
  208.       2=Must survive,
  209.       3=Must survive and finish flightpath,
  210.       4=No special datablock
  211.       5=Must not land)
  212.   */
  213.   char flags_2;
  214.   /*  [b0]    Ignore incoming attack? (0=No, 1=Yes)
  215.       [b1]    On flightpath, player proximity action
  216.               (0=Ignore, 1=Join formation (Fr) or attack(En)) */
  217.   char bigship_movement;
  218.   /*  0=fly around
  219.       1=spinning top space station
  220.       2=rotating wheel space station
  221.       3=don't move */
  222.   char direction_and_pilot;
  223.   /*  [b0-b3]    Pilot's name (0-15)
  224.       [b4-b7]    Starting direction (0-15) */
  225. } SF_ShipAdderData;
  226.  
  227. typedef struct _SF_FlightPathPoint
  228. {
  229.   char X_coord;
  230.   char Y_coord;
  231.   char Z_coord;
  232.   char waste;
  233. } SF_FlightPathPoint;
  234.  
  235. typedef struct _SF_FlightPath
  236. {
  237.   int number_of_points;
  238.   SF_FlightPathPoint points[64];
  239. } SF_FlightPath;
  240.  
  241. /* Special mission variables */
  242. #define SV_SCANNER_KNACKERED 0
  243. #define SV_NO_GROUND_DAMAGE  1
  244.  
  245. typedef char SF_Filename[12];
  246.  
  247. typedef struct _SF_Mission
  248. {
  249.   /* Player starting position */
  250.   char player_xpos;
  251.   char player_ypos;
  252.   char player_height;
  253.   char player_direction;
  254.  
  255.   /* Special ship details */
  256.   char player_has_specialship; /* (0=No, 1=Yes) */
  257.   char specialship_laser_type;
  258.   char specialship_engine;
  259.   char specialship_control;
  260.   char specialship_shields;
  261.   char specialship_ATA;
  262.   char specialship_ATG;
  263.   char specialship_mines;
  264.   char specialship_bombs;
  265.   char specialship_megalaser;
  266.   char specialship_multiATA;
  267.   char specialship_shiptype;
  268.  
  269.   /* Misc stuff */
  270.   char num_hits_against_allowed;
  271.   char plebadder_type1_2;
  272.   char plebadder_type3_4;
  273.   char space_mission; /* (0=No, 1=Yes) */
  274.   char cloud_colour_1;
  275.   char cloud_colour_2;
  276.   char dock_to_finish; /* (0=No, 1=Yes) */
  277.   char start_docked; /* (255=No else Yes) */
  278.  
  279.   /* Ground targets/check objects */
  280.   int num_ground_checks;
  281.   SF_Trigger ground_checks[64];
  282.  
  283.   /* Location briefings */
  284.   int num_location_briefings;
  285.   SF_LocationBrief location_briefings[16];
  286.  
  287.   /* Timers */
  288.   int mission_timer;
  289.   int defence_timer;
  290.  
  291.   /* General mission difficulty */
  292.   char laser_fire_freq;
  293.   char laser_fire_type;
  294.   char launch_type_and_number;
  295.   char hangar_launch_freq;
  296.  
  297.   /* Mission number */
  298.   int level_number;
  299.   int pyramid_number;
  300.  
  301.   /* Special mission variables */
  302.   char special_vars[32];
  303.  
  304.   /* Ship performance data */
  305.   SF_ShipPerfData ships_performance[7];
  306.  
  307.   /* Flying ships list */
  308.   int num_ships_flying;
  309.   SF_ShipAdderData ships_flying[32];
  310.  
  311.   /* Flightpaths */
  312.   int num_flightpaths;
  313.   SF_FlightPath flightpaths[8];
  314.  
  315.   /* Associated / component files */
  316.   SF_Filename map_tiles_basemap;
  317.   SF_Filename map_tiles_levmap;
  318.   SF_Filename ground_objects_basemap;
  319.   SF_Filename ground_objects_levmap;
  320.   SF_Filename animations;
  321.   SF_Filename map_tiles_set;
  322.   SF_Filename polygonal_objects_set;
  323.   SF_Filename sky_colour_bands;
  324.   SF_Filename planet_pictures_set;
  325.   SF_Filename palette;
  326.   SF_Filename hill_colours;
  327.  
  328.   /* Mission and location briefing text */
  329.   int textbriefs;
  330.   int textvisits;
  331.   int textstroff[19];
  332.   char title[32];
  333.   char textstrings[3*1024];
  334. } SF_Mission;
  335.  
  336. typedef struct _SF_TextData
  337. {
  338.    int header[12];
  339.    /*-- string follows here in memory, terminated by 255 --*/
  340.    char string[];
  341. } SF_TextData;
  342.  
  343.  
  344. /* 
  345.   Planets file format
  346.   Purpose: Contains the pictures of distant planets painted onto the sky.
  347. */
  348.  
  349. #define FILETYPE_PLANETS 0x406
  350.  
  351. #define SF_PLANET_WIDTH  36
  352. #define SF_PLANET_HEIGHT 36
  353.  
  354. typedef char SF_PlanetBitmap[SF_PLANET_WIDTH][SF_PLANET_HEIGHT];
  355.  
  356. typedef struct _SF_PlanetPaintOffset
  357. {
  358.    int xoffset; /* (Obsolete?) */
  359.    int yoffset; /* (Obsolete?) */
  360. } SF_PlanetPaintOffset;
  361.  
  362. typedef struct _SF_PlanetDataOffset
  363. {
  364.    int dataoffset;
  365.    int maskoffset; /* (Obsolete?) */
  366. } SF_PlanetDataOffset;
  367.  
  368. typedef struct _SF_PlanetsSetHdr
  369. {
  370.    int lastplanet_num;
  371.    SF_PlanetPaintOffset paintoffsets[2]; /* (Obsolete?) */
  372.    SF_PlanetDataOffset dataoffsets[2];
  373.    /*-- planets follow here in memory --*/
  374.    SF_PlanetBitmap planets[];
  375. } SF_PlanetsSetHdr;
  376.  
  377. /* 
  378.   Map tile graphics set format
  379.   Purpose: Contains the the full range of available map tiles in a given set.
  380. */
  381.  
  382. #define FILETYPE_MAPTILES 0x407
  383.  
  384. #define SF_MAPTILE_WIDTH  16
  385. #define SF_MAPTILE_HEIGHT 16
  386.  
  387. typedef char SF_MapTile[SF_MAPTILE_WIDTH][SF_MAPTILE_HEIGHT];
  388.  
  389. typedef struct _SF_MapTilesSetHdr
  390. {  int lasttile_num;
  391.    char splash_anim_1[4];
  392.    char splash_anim_2[4];
  393.    char splash_2_triggers[4];
  394.    /*-- tiles follow here in memory --*/
  395.    SF_MapTile tiles[];
  396. } SF_MapTilesSetHdr;
  397.  
  398. /* 
  399.   Hill colours format
  400.   Purpose: Gives the colour palette used for the polygonal mountains.
  401. */
  402.  
  403. typedef char SF_HillCols[3][12];
  404.  
  405. /* 
  406.   Polygon colours format
  407.   Purpose: Maps the 320 logical colours used on polygonal objects in the
  408.            game to the standard static 256 colours available in mode 13.
  409. */
  410.  
  411. typedef union _SF_ColourMap
  412. {
  413.   /* Plain and simple */
  414.   char colour_mappings[320];
  415.  
  416.   /* Area allocations */
  417.   struct {
  418.     char static_colours[256];
  419.  
  420.     struct {
  421.       char player_engine[4];
  422.       char fighter_engine[4];
  423.       char cruiser_engine[4];
  424.       char super_engine[4];
  425.     } engine_colours;
  426.  
  427.     struct {
  428.       char enemy_ships[4];
  429.       char friendly_ships[4];
  430.       char player_ship[4];
  431.     } fast_flashing;
  432.  
  433.     struct {
  434.       char ground_obj_1[4];
  435.       char ground_obj_2[4];
  436.       char misc_1[4];
  437.       char misc_2[4];
  438.     } med_flashing;
  439.  
  440.     char player_livery[20];
  441.   } areas;
  442. } SF_ColourMap;
  443.  
  444. /* 
  445.   Music tracks format
  446.   Purpose: Used by SFX_Handler module music player.
  447. */
  448.  
  449. typedef struct _SF_MusicCommand {
  450.   char pitch;
  451.   char octave_and_volume;
  452.   char sample_and_command;
  453.   char repeats;
  454. } SF_MusicCommand;
  455.  
  456. /* Encoding of note data:
  457.   bits... 28 24       20      16      12       8  4      0
  458.    {repeats}{ }{command}{sample}{volume}{octave}{ }{pitch} */
  459.  
  460. typedef struct _SF_MusicLine {
  461.   SF_MusicCommand commands[4];
  462. } SF_MusicLine;
  463. /* (each line is 16 bytes) */
  464.  
  465. typedef struct _SF_MusicSheet {
  466.   SF_MusicLine lines[64];
  467. } SF_MusicSheet;
  468. /* (each sheet is 1024 bytes) */
  469.  
  470. typedef struct _SF_MusicHdr {
  471.   char tempo; /* Metronome value */
  472.   char free[15]; /* FREE Header data */
  473.   char note_trans[16]; /* Logical to actual voice mapping */
  474.   int number_sheets; /* Number of sheets */
  475.   int number_play; /* obsolete */
  476.   char sheets_order[64]; /* Sheets play order (255 Term) */
  477.    /*-- sheets follow here in memory --*/
  478.    SF_MusicSheet sheets[];
  479. } SF_MusicHdr;
  480.  
  481. #endif
  482.